package com.example.videodemo;

import android.app.Application;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;

import com.example.jna.HCNetSDKJNAInstance;


import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;

import java.util.List;

public class DemoViewModel extends AndroidViewModel {
    private RcvModel rcvModel;
    private RcvData rcvData;
    private List<RcvJpg> list;

    public DemoViewModel(@NonNull Application application) {
        super(application);
        rcvModel = RcvModel.getInstance();


    }

    int initSDK() {
        return rcvModel.initSDK();
    }

    public void setRcvData(RcvData rcvData) {
        this.rcvData = rcvData;
    }

    public DeviceItem login() {
        return rcvModel.login(rcvData);
    }

//    public int startPlay(SurfaceView m_osurfaceView, int iPreviewID, int Chanel) {
//
//        return rcvModel.startPlay(m_osurfaceView, iPreviewID, Chanel);
//    }
    public int startPlay(SurfaceView m_osurfaceView, int iPreviewID, int position) {

        return rcvModel.startPlay(m_osurfaceView, iPreviewID, list.get(position).getChanel());
    }

    public int RealPlaySurfaceChanged_jni(int iPreviewID, int i, SurfaceHolder holder) {
        return rcvModel.RealPlaySurfaceChanged_jni(iPreviewID, i, holder);
    }

    public void RealPlay_Stop(int iPreviewID) {
        rcvModel.RealPlay_Stop(iPreviewID);
    }

    public List<RcvJpg> getRcvChanel() {
        list = rcvModel.getRcvChanel();
        return list;
    }
}
